package com.acme.bankapp.service.bank;

import com.acme.bankapp.domain.bank.*;

/**
 * @author Artem Kalchenko
 *
 */
public class SystemTest {
	
	private static Bank theBank = new Bank();
	private static BankService bs = new BankService();
	
	
	public static void main(String[] args) {
		Client clSmith = new Client("Smith", Gender.MALE);
		Client clLiskov = new Client("Liskov", Gender.FEMALE, new CheckingAccount(500,100));
		
		bs.addClient(theBank, clSmith);
		bs.addClient(theBank, clLiskov);
		
		System.out.println("List of clients:\n" + bs.getClientsListAsString(theBank));
		
		System.out.println(bs.getAccountsList(theBank));
		
		// add an account for Smith
		bs.addAccount(clSmith, new SavingsAccount(750));
		System.out.println(bs.getAccountsList(theBank));
		
		// deposit money on Smith's acc
		bs.deposit(bs.getClientsList(theBank).get(0), 249);
		System.out.println(bs.getClientAccount(bs.getClientsList(theBank).get(0)));
		
		// withdraw too much money from Liskov
		if (bs.withdraw(clLiskov, 666)){
			System.out.println("Money withdrawn");
		} else {
			System.out.println("not enough money");
		}
		
		// set new overdraft for Liskov
		bs.setOverdraftLimit(clLiskov, 250);
		
		if (bs.withdraw(clLiskov, 666)){
			System.out.println("Money withdrawn");
		} else {
			System.out.println("Not enough money");
		}
		
		System.out.println(bs.getAccountsList(theBank));
	}
}
